package com.cloud.haiyan_base.validator.annotion;

import com.cloud.haiyan_base.validator.Messages;
import com.cloud.haiyan_base.validator.constraint.IdValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;


@Target({TYPE, ANNOTATION_TYPE, FIELD})//指明作用域
@Retention(RetentionPolicy.RUNTIME)//用来修饰注解的注解，RetentionPolicy.RUNTIME：注解不仅被保存到class文件中，jvm加载class文件之后，仍然存在；
@Constraint(validatedBy = {IdValidator.class})//指明实现类
public @interface IdValid {

    boolean required() default true;

    String message() default Messages.ID_LENGTH_THIRTY_TWO;

    String value() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
